- /* snfblksf.cpp by K.Tsuru */
- // function ID = 101
- /************************************************************
- SNumber auxiliary function
- Provides the shift to upper(n>0) or lower(n<0) of FigBlock.
- It does not enlarge the size, i.e. cut off an oversize area.
- If abs(n) >= a.size(), "a" is initialized by zero.
- *************************************************************/
- #ifndef SN_H
- #include "sn.h"
- #endif
-
- int FigBlockShift(FigBlock& a, int n){
- if(!n) return 1;
- fType* ev = a.Elements();
-
- int mv = (int)a.size() - abs(n);
- if( mv <= 0 ){ a.clear(0); return 0; }
-
- if(n > 0){ //shift to upper ev[j+n] <-- ev[j] for 0<= j < a.size() -n = mv
- memmove(&ev[n], &ev[0], sizeof(fType)*mv);
- a.clear(0, n-1); //clear lower part
- } else { //shift to lower ev[j] <-- ev[j+|n|]
- n = -n;
- memmove(&ev[0], &ev[n], sizeof(fType)*mv);
- a.clear(mv); //clear upper part
- }
- return 1;
- }
snfblksf.cpp : last modifiled at 2017/03/13 14:32:01(916 bytes)
created at 2016/04/11 11:36:47
The creation time of this html file is 2017/10/27 10:59:17 (Fri Oct 27 10:59:17 2017).